﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Share.Models;
using Front.Models.View;

namespace eShop.Controllers
{
    public class CategoryController : Controller
    {
        //
        // GET: /Category/Index/1

        public ActionResult Index(int id)
        {
            VMCategoryIndex Model = new VMCategoryIndex();

            Model.Category = DB.Current.Categories.Find(id);
            if (Model.Category == null)
                return HttpNotFound();

            Model.RootCategory = Model.Category.FindRootCategory();

            //TODO: 应包含所有子类的产品
            Model.Items = Model.Category.Items;

            return View(Model);
        }

        //
        // GET: /Category/v2

        public ActionResult v2()
        {
            return View();
        }

        //
        // GET: /Category/Sales

        public ActionResult Sales()
        {
            return View();
        }
    }
}
